Get an absolute file pathΒΆ

Get an absolute file path.
def absolute_file_path(path_fname):
    import os
    return os.path.abspath('path_fname')

print("Absolute file path: ", absolute_file_path("test.txt"))

Output:

Absolute file path:  /home/students/path_fname